package com.lhb.common.components;

import javax.swing.*;
import java.awt.*;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;

public class TopPanelJTextField extends JTextField {



    public TopPanelJTextField(String text) {

       setText(text);
       setBackground(Color.WHITE);

       addFocusListener(new FocusAdapter() {
           @Override
           public void focusGained(FocusEvent e) {

               if(getText().equals(text)) {

                   setText("");

               }


           }

           @Override
           public void focusLost(FocusEvent e) {
               if(getText().equals(""))
                setText(text);
           }
       });




    }









}
